package com.efast.cafe.portal.controller.common;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.efast.cafe.framework.bean.ResultBean;
import com.efast.cafe.framework.controller.AbstractController;
import com.efast.cafe.framework.enums.ResultStatus;
import com.efast.cafe.portal.bean.common.EntityInfoBean;
import com.efast.cafe.portal.service.common.IEntityInfoQueryService;

@Controller
public class EntityInfoQueryController extends AbstractController{
	@Autowired
	private IEntityInfoQueryService queryService;
	
	



	@RequestMapping(value = "/frame_center/common/entityInfo")
	public @ResponseBody ResultBean queryEntityInfo(@RequestBody Map<String,String> map){
		ResultBean res = new ResultBean(true,null);
		try{
			if(map.containsKey("entityName") && StringUtils.isNotBlank(map.get("entityName"))){
				EntityInfoBean en = queryService.queryEntityInfo(map.get("entityName"));
				res.setObject(en);
			}else{
				res.setSuccess(false);
				res.setErrorCode(ResultStatus.PARAM_ERROR.getCode());
			}
		}catch(Exception e){
			e.printStackTrace();
			res.setSuccess(false);
			res.setErrorCode(ResultStatus.SYS_ERROR.getCode());
		}
		return res;
	}
}
